Conversation
81dc3e6 to
97d7ef9
Compare
5f60603 to
6010307
Compare
97d7ef9 to
af1783e
Compare
af1783e to
abc4ea2
Compare
abc4ea2 to
9b1d31c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b1d31cb67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func Start(ctx context.Context, opts Options) error { | ||
| if _, ok := agent.Get(opts.Agent); !ok { | ||
| return fmt.Errorf("unsupported agent %q (supported: %s)", opts.Agent, strings.Join(supportedAgents(), ", ")) | ||
| agentPath, err := preflightAgent(opts.Agent) |
There was a problem hiding this comment.
Re-resolve the agent binary right before launch
Start caches agentPath before auth/session/bootstrap and then executes that same path much later, so a binary swap/removal during setup (for example, an auto-update or any writable PATH directory) can still cause a late failure or execute a different file than the one originally preflighted. This weakens the stated preflight guarantee because launchability is no longer checked at the point of exec.Command; re-validating the path immediately before launch would avoid this long TOCTOU window.
Useful? React with 👍 / 👎.

Summary
Why
If Claude is missing or cannot run, the CLI should say that before doing any auth or provider work. Developers get a faster failure and avoid creating managed sessions for a launch that was never possible.
Before / After Terminal Capture
Before, setup could run before discovering Claude was unavailable or invalid:
After, agent setup fails immediately:
For an agent that launches and exits early, the user gets Kontext context:
Verification
go test ./...on this branch.